package cn.jinzhu.zipkin1;



import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
//使用链路可以查看客户端的请求到底调用了哪些服务，因为每个服务都有一个spendId 当访问下一个服务请求，就会携带上一个spenid去访问，上一个spendID会变成tracdid


//链路追踪只要加了依赖就可以根据日志和客户端的请求追踪它的错误
@RestController
public class HelloController {

    private static final Log log= LogFactory.getLog(HelloController.class);
    @Autowired
    RestTemplate restTemplate;
    @GetMapping("/hello")
    public String hello() throws InterruptedException {
        log.info("ZipKin1-hello");
        Thread.sleep(500);
       return restTemplate.getForObject("http://localhost:8080/hello",String.class);
    }



}
